package jscinttools.utilities.aidautilities;

import hep.aida.*;
import java.io.*;

/**
 *  Grab a IManagedObject (IHistogram, IDataPointSet, IFunction, ITuple, etc...)
 *  in an Aida ITree
 *
 *@author     Marc-Antoine Verdier
 *@created    11 février 2011
 */
public class GrabIObject implements Serializable
{
	/**
	 *  The IDataPointSet
	 */
	private IDataPointSet dps = null;

	/**
	 *  The IHistogram1D
	 */
	private IHistogram1D histo1D = null;

	/**
	 *  The IHistogram2D
	 */
	private IHistogram2D histo2D = null;

	/**
	 *  The IHistogram3D
	 */
	private IHistogram3D histo3D = null;

	/**
	 *  The ICloud1D
	 */
	private ICloud1D cloud1D = null;

	/**
	 *  The ICloud2D
	 */
	private ICloud2D cloud2D = null;

	/**
	 *  The ICloud3D
	 */
	private ICloud3D cloud3D = null;

	/**
	 *  The IProfile1D
	 */
	private IProfile1D profile1D = null;

	/**
	 *  The IProfile2D
	 */
	private IProfile2D profile2D = null;

	/**
	 *  The IFunction
	 */
	private IFunction func = null;

	/**
	 *  The ITuple
	 */
	private ITuple tuple = null;



	/**
	 *  Default Constructor for the GrabIObject object
	 */
	public GrabIObject() { }


	/**
	 *  Find an IManagedObject in an ITree
	 *
	 *@param  tree        The ITree
	 *@param  objectPath  The Path of the IManagedObject
	 *@param  objectName  The Name of the IManagedObject
	 */
	public GrabIObject(ITree tree, String objectPath, String objectName)
	{
		this(tree, objectPath + File.separator + objectName);
	}



	/**
	 *  Constructor for the GrabIObject object
	 *
	 *@param  tree            The ITree
	 *@param  objectFullName  The Full Name of the IManagedObject
	 */
	public GrabIObject(ITree tree, String objectFullName)
	{
		IManagedObject iObject = tree.find(objectFullName);

		if (iObject.type().equals("IDataPointSet"))
			dps = (IDataPointSet) iObject;

		else if (iObject.type().equals("IHistogram1D"))
			histo1D = (IHistogram1D) iObject;

		else if (iObject.type().equals("IHistogram2D"))
			histo2D = (IHistogram2D) iObject;

		else if (iObject.type().equals("IHistogram3D"))
			histo3D = (IHistogram3D) iObject;

		else if (iObject.type().equals("ICloud1D"))
			cloud1D = (ICloud1D) iObject;

		else if (iObject.type().equals("ICloud2D"))
			cloud2D = (ICloud2D) iObject;

		else if (iObject.type().equals("ICloud3D"))
			cloud3D = (ICloud3D) iObject;

		else if (iObject.type().equals("IProfile1D"))
			profile1D = (IProfile1D) iObject;

		else if (iObject.type().equals("IProfile2D"))
			profile2D = (IProfile2D) iObject;

		else if (iObject.type().equals("IFunction"))
			func = (IFunction) iObject;

		else if (iObject.type().equals("ITuple"))
			tuple = (ITuple) iObject;
	}


	///**
	// *  Gets the iObject attribute of the GrabIObject object
	// *
	// *@return    The iObject value
	// */
	//public IManagedObject getIObject()
	//{
	//	return iObject;
	//}

	/**
	 *  Gets the dps attribute of the GrabIObject object
	 *
	 *@return    The dps value
	 */
	public IDataPointSet getDps()
	{
		return dps;
	}


	/**
	 *  Gets the histo1D attribute of the GrabIObject object
	 *
	 *@return    The histo1D value
	 */
	public IHistogram1D getHisto1D()
	{
		return histo1D;
	}


	/**
	 *  Gets the histo2D attribute of the GrabIObject object
	 *
	 *@return    The histo2D value
	 */
	public IHistogram2D getHisto2D()
	{
		return histo2D;
	}


	/**
	 *  Gets the histo3D attribute of the GrabIObject object
	 *
	 *@return    The histo3D value
	 */
	public IHistogram3D getHisto3D()
	{
		return histo3D;
	}


	/**
	 *  Gets the cloud1D attribute of the GrabIObject object
	 *
	 *@return    The cloud1D value
	 */
	public ICloud1D getCloud1D()
	{
		return cloud1D;
	}


	/**
	 *  Gets the cloud2D attribute of the GrabIObject object
	 *
	 *@return    The cloud2D value
	 */
	public ICloud2D getCloud2D()
	{
		return cloud2D;
	}


	/**
	 *  Gets the cloud3D attribute of the GrabIObject object
	 *
	 *@return    The cloud3D value
	 */
	public ICloud3D getCloud3D()
	{
		return cloud3D;
	}


	/**
	 *  Gets the profile1D attribute of the GrabIObject object
	 *
	 *@return    The profile1D value
	 */
	public IProfile1D getProfile1D()
	{
		return profile1D;
	}


	/**
	 *  Gets the profile2D attribute of the GrabIObject object
	 *
	 *@return    The profile2D value
	 */
	public IProfile2D getProfile2D()
	{
		return profile2D;
	}


	/**
	 *  Gets the func attribute of the GrabIObject object
	 *
	 *@return    The func value
	 */
	public IFunction getFunc()
	{
		return func;
	}


	/**
	 *  Gets the tuple attribute of the GrabIObject object
	 *
	 *@return    The tuple value
	 */
	public ITuple getTuple()
	{
		return tuple;
	}
}

